﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DA;
using System.Data.Objects;

namespace BL
{
    public class ItemsInOrderRepository
    {
        public IEnumerable<ItemsInOrder> GetList(int orderId, params string[] includeList)
        {
            using (OrdersDeskEntities db = new OrdersDeskEntities())
            {
                ObjectQuery<ItemsInOrder> retTable = db.ItemsInOrders;

                foreach (string include in includeList)
                {
                    retTable = retTable.Include(include);
                }

                return retTable.Where(x => x.OrderId == orderId).ToList();
            }
        }
    }
}
